/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.home.tax.model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author TIN Nguyen
 */
@Entity
@Table(name = "DoanhNghiep")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DoanhNghiep.findAll", query = "SELECT d FROM DoanhNghiep d"),
    @NamedQuery(name = "DoanhNghiep.findByMaSoThue", query = "SELECT d FROM DoanhNghiep d WHERE d.maSoThue = :maSoThue"),
    @NamedQuery(name = "DoanhNghiep.findByTenDoanhNghiep", query = "SELECT d FROM DoanhNghiep d WHERE d.tenDoanhNghiep = :tenDoanhNghiep"),
    @NamedQuery(name = "DoanhNghiep.findByDiaChi", query = "SELECT d FROM DoanhNghiep d WHERE d.diaChi = :diaChi")})
public class DoanhNghiep implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "MaSoThue")
    private String maSoThue;
    @Basic(optional = false)
    @Column(name = "TenDoanhNghiep")
    private String tenDoanhNghiep;
    @Basic(optional = false)
    @Column(name = "DiaChi")
    private String diaChi;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "maSoThue")
    private Collection<HoSo> hoSoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "maSoThue")
    private Collection<KetQua> ketQuaCollection;

    public DoanhNghiep() {
    }

    public DoanhNghiep(String maSoThue) {
        this.maSoThue = maSoThue;
    }

    public DoanhNghiep(String maSoThue, String tenDoanhNghiep, String diaChi) {
        this.maSoThue = maSoThue;
        this.tenDoanhNghiep = tenDoanhNghiep;
        this.diaChi = diaChi;
    }

    public String getMaSoThue() {
        return maSoThue;
    }

    public void setMaSoThue(String maSoThue) {
        this.maSoThue = maSoThue;
    }

    public String getTenDoanhNghiep() {
        return tenDoanhNghiep;
    }

    public void setTenDoanhNghiep(String tenDoanhNghiep) {
        this.tenDoanhNghiep = tenDoanhNghiep;
    }

    public String getDiaChi() {
        return diaChi;
    }

    public void setDiaChi(String diaChi) {
        this.diaChi = diaChi;
    }

    @XmlTransient
    public Collection<HoSo> getHoSoCollection() {
        return hoSoCollection;
    }

    public void setHoSoCollection(Collection<HoSo> hoSoCollection) {
        this.hoSoCollection = hoSoCollection;
    }

    @XmlTransient
    public Collection<KetQua> getKetQuaCollection() {
        return ketQuaCollection;
    }

    public void setKetQuaCollection(Collection<KetQua> ketQuaCollection) {
        this.ketQuaCollection = ketQuaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (maSoThue != null ? maSoThue.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DoanhNghiep)) {
            return false;
        }
        DoanhNghiep other = (DoanhNghiep) object;
        if ((this.maSoThue == null && other.maSoThue != null) || (this.maSoThue != null && !this.maSoThue.equals(other.maSoThue))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.home.tax.model.DoanhNghiep[ maSoThue=" + maSoThue + " ]";
    }
    
}
